import { defineStore } from 'pinia'
import {reactive} from 'vue'
import {
	DATATAG,
	request_get_user_tag,
	request_get_user_list,
	request_get_article_list,
	request_get_article_all_list
} from '../service/tagLibrary'


export default defineStore('useTagLibraryStore', () => {
	const contentTagList = reactive({
		articleList: [],
		userList: [],
		articleAllList: []
	})
	
	// 内容标签数据一级下拉
	const articleList = async () => {
		const data = await request_get_article_list()
		contentTagList.articleList = data?.data
	}
	
	// 内容标签数据二级下拉
	const articleAllList = async () => {
		const data = await request_get_article_all_list()
		contentTagList.articleAllList = data?.data
	}
	
	// 用户标签数据二级菜单
	const userList = async () => {
		const res = await request_get_user_list()
		contentTagList.userList = res?.data
		return res?.data
	}
	// 标签id需要使用,分割开 用户选择标签
	const userTag = async (dataTag: DATATAG) => {
		const data = await request_get_user_tag(dataTag)
		console.log(data, "| data用户选择");
	}
	return { 
		articleList, 
		articleAllList,
		userTag, 
		userList,
		contentTagList
	}
})